<!DOCTYPE html>
{% load i18n %}
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="shortcut icon" type="image/png" href="/static/favicon.ico"/>
    <link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
    {% include 'show/link.html'%}
    <!--- art template web -->
    <!-- ie compatible -->
    <script src="/static/lib/art-template/web-ie-compatible/es5-shim.min.js"></script>
    <script src="/static/lib/art-template/web-ie-compatible/es5-sham.min.js"></script>
    <script src="/static/lib/art-template/web-ie-compatible/json3.min.js"></script>
    <!-- ie compatible end -->
    <script src="/static/lib/art-template/template-web.js"></script>
    <!--- art template web end -->
    <link type="text/css" href="/static/lib/jquery-ui/css/custom-theme/jquery-ui-1.10.0.custom.css" rel="stylesheet"/>
    {% include 'show/common_define.html' %}
    <script src="/static/site/common_func.js"></script>
    <script src="/static/lib/jquery-ui/assets/js/jquery-ui-1.10.0.custom.min.js" type="text/javascript"></script>
    <title>{% trans 'gm_c2c' %}</title>
    <style>
        .panel {
            border-radius: 0px;
            border:1px solid #f1f1f1
        }
        .panel-heading {
            border-radius: 0px;
        }

        .bank_block {
            background:#f9f9f9;
            margin: 5px 10px 5px 10px;
            height: 100px;
            width: 200px;
            border-radius: 5px;
            border: 1px solid rgba(169,191,205 ,0.7); /* 1px, solid 颜色 */
        }
        .bank_block  .center {
            position:relative; top:40%;
        }
    </style>

    <script>
        {% if user.is_authenticated %}
        g_auth = true;
        {% endif %}

        $(document).ready(function() {
            $("#deposit_button").click(function(){
                on_gm_deposit_click()
            });
            $("#withdraw_button").click(function(){
                on_gm_withdraw_click()
            });
        })

        function on_gm_deposit_click()
        {
            $.post("{% url 'cs:gm_deposit' %}",
            $("#deposit_form").serialize(),
            function(ret){
                if (ret == '0') {
                    $("#deposit_msg").html("{% trans '充值成功,请在24小时内汇款对方' %}")
                    //get_deposit_detail()
                } else if (ret == '1'){
                    $("#deposit_msg").html("{% trans '用户ID错误' %}")
                } else if (ret == '2'){
                    $("#deposit_msg").html("{% trans '用户邮箱错误' %}")
                } else {
                    $("#deposit_msg").html("{% trans '充值失败' %}")
                }
            })
        }
        function on_gm_withdraw_click()
        {
            $.post("{% url 'cs:gm_withdraw' %}",
            $("#withdraw_form").serialize(),
            function(ret){
                if (ret == '0') {
                    $("#withdraw_msg").html("{% trans '提现成功' %}")
                    //get_withdraw()
                } else if (ret == '1') {
                    $("#withdraw_msg").html("{% trans '用户ID错误' %}")
                } else if (ret == '2') {
                    $("#withdraw_msg").html("{% trans '用户邮箱错误' %}")
                } else if (ret ==  '3') {
                    $("#withdraw_msg").html("{% trans '币种错误' %}")
                } else if (ret ==  '4') {
                    $("#withdraw_msg").html("{% trans '提现金额太小' %}")
                } else if (ret ==  '5') {
                    $("#withdraw_msg").html("{% trans '余额不足' %}")
                } else if (ret ==  '6') {
                    $("#withdraw_msg").html("{% trans '服务器异常' %}")
                } else {
                    $("#withdraw_msg").html(
                      "{% trans '服务器错误,提现失败,请稍后再试' %} error "
                      + ret)
                }
            })
        }
    </script>
</head>

<body>
{% include 'show/top_bar.html' %}
<div class="main_body">
    <br>
    <br>
        <ol class="breadcrumb">
            <li><a href="{%url 'index'%}">{% trans '首页' %}</a></li>
            <li><a href="/cs/">{% trans '管理页面' %}</a></li>
        </ol>
    <div class="pushAd container">
        <div class="panel panel-bm ">
            <div class="panel-heading">
                <div class="panel-heading-title">
                    BitCNY {% trans '管理员操作点对点交易' %}
                </div>
            </div>
            <div class="panel-body row">
                <div class="col-md-6">
                    <form class="form-horizontal" id="deposit_form" method="post" role="form">
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值用户ID' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_green green">{% trans '用户ID' %}</span>
                                    <input type="text" class="form-control green" id="deposit_userid" name="deposit_userid" placeholder="{% trans '充值用户ID' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值用户邮箱' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_green green">{% trans '用户邮箱' %}</span>
                                    <input type="text" class="form-control green" id="deposit_user_email" name="deposit_user_email" placeholder="{% trans '充值用户邮箱' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值币种' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <div id="coin_type_select"> </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值数量' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_green green">{% trans '充值数量' %}</span>
                                    <input type="text" class="form-control green" id="deposit_count" name="deposit_count" placeholder="{% trans '充值数量' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10 ">
                                <button type="button" id="deposit_button" class="btn btn-block btn-success" data-toggle="tooltip">{% trans '充值' %}</button>
                            </div>
                        </div>
                        <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10 ">
                            <p><span class="form-control-static" id="deposit_msg" class="red"> </span>
                        </div>
                        {% csrf_token %}
                    </form>
                </div>
                <div class="col-md-6">
                    <form class="form-horizontal" id="withdraw_form" method="post" role="form">
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '提现用户ID' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_green green">{% trans '用户ID' %}</span>
                                    <input type="text" class="form-control green" id="withdraw_userid" name="withdraw_userid" placeholder="{% trans '提现用户ID' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '提现用户邮箱' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_green green">{% trans '用户邮箱' %}</span>
                                    <input type="text" class="form-control green" id="withdraw_user_email" name="withdraw_user_email" placeholder="{% trans '提现用户邮箱' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '充值币种' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <div id="coin_type_select2"></div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lastname" class="col-sm-offset-0 col-sm-3 col-xs-offset-1 col-xs-2 control-label">{% trans '提现数量' %}</label>
                            <div class="col-sm-8 col-xs-8">
                                <div class="input-group">
                                    <span class="input-group-addon svg_red red">{% trans '提现数量' %}</span>
                                    <input type="text" class="form-control red" id="withdraw_count" name="withdraw_count" placeholder="{% trans '提现数量' %}">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10 ">
                                <button type="button" id="withdraw_button" class="btn btn-block btn-danger" data-toggle="tooltip">{% trans '提现' %}</button>
                            </div>
                        </div>
                        <div class="col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10 ">
                            <p><span class="form-control-static" id="withdraw_msg" class="red"> </span>
                        </div>
                        {% csrf_token %}
                    </form>
                </div>
            </div>
        </div>
    </div>
</div> <!-- end container-->
</div><!-- end main_body-->
{% include 'show/footer.html' %}
</body>
</html>
<script>
    $(document).ready(function() {
        var data = {
            g_coin_info : g_coin_info
        }
        console.log(g_coin_info )
        var html = template('temp_coin_type_select' , data);
        document.getElementById('coin_type_select').innerHTML = html;
        var html = template('temp_coin_type_select' , data);
        document.getElementById('coin_type_select2').innerHTML = html;
    })
</script>

<script id="temp_coin_type_select" type="text/html">
    <span class="input-group-addon svg_green green">{% trans '币种' %}</span>
    <select class="form-control" name="coin_type">
        <% for (coin_type in  g_coin_info) {%>
            <% var info = g_coin_info[coin_type] %>
            <option value="<%=coin_type%>"><%=coin_type%></option>
        <% } %>
    </select>
</script>
